package com.nondo.dean.order.model.param;

import java.math.BigDecimal;
import java.util.List;

import javax.validation.constraints.NotNull;

import org.apache.commons.collections.CollectionUtils;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

@JsonIgnoreProperties(ignoreUnknown = true)
public class OrderProductParam {
    /**
     * 订单ID
     */
    @NotNull(message = "订单ID不能为空")
    private Integer id;
    /**
     * 订单明细
     */
    private List<OrderDetailParam> orderDetailList;

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public List<OrderDetailParam> getOrderDetailList() {
        return orderDetailList;
    }

    public void setOrderDetailList(List<OrderDetailParam> orderDetailList) {
        this.orderDetailList = orderDetailList;
    }

    @JsonIgnoreProperties(ignoreUnknown = true)
    public static class OrderDetailParam {
        /**
         * 明细ID
         */
        private Integer id;
        /**
         * 产品数量
         */
        private Integer purchaseQuantity;
        
        /**
         * 异形调价
         */
        private BigDecimal specialPrice;
        
        /**
         * PO项目
         */
        private String poItem;
        
        /**
         * 单品备注
         */
        private String note;

        public Integer getId() {
            return id;
        }

        public void setId(Integer id) {
            this.id = id;
        }

        public Integer getPurchaseQuantity() {
            return purchaseQuantity;
        }

        public void setPurchaseQuantity(Integer purchaseQuantity) {
            this.purchaseQuantity = purchaseQuantity;
        }

        public BigDecimal getSpecialPrice() {
            return specialPrice;
        }

        public void setSpecialPrice(BigDecimal specialPrice) {
            this.specialPrice = specialPrice;
        }

        public String getPoItem() {
            return poItem;
        }

        public void setPoItem(String poItem) {
            this.poItem = poItem;
        }

        public String getNote() {
            return note;
        }

        public void setNote(String note) {
            this.note = note;
        }


    }

    public static String checkInputParam(OrderProductParam orderProductParam) {
        List<OrderDetailParam> orderDetailList = orderProductParam.getOrderDetailList();
        if(CollectionUtils.isEmpty(orderDetailList)) {
            return "要修改的订单明细不能为空";
        }
        return null;
    }
}
